home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / sos3-2.lha / bin / sos-cct < prev    next >
Text File  |  1992-02-13  |  1KB  |  49 lines

  1. #!/bin/sh
  2. # --------------------------------------------------------------------------
  3. # Copyright 1992 by Forschungszentrum Informatik (FZI)
  4. #
  5. # You can use and distribute this software under the terms of the licence
  6. # you should have received along with this program.
  7. # If not or if you want additional information, write to
  8. # Forschungszentrum Informatik, "STONE", Haid-und-Neu-Strasse 10-14,
  9. # D-7500 Karlsruhe 1, Germany.
  10. # --------------------------------------------------------------------------
  11. # 'sos-cct - 27:02:91 - Dietmar Theobald'
  12. #
  13. # sos-cct [-l [<delay>]]
  14. #
  15. # Clean container directory: remove empty containers and squeeze nonempty ones
  16. # in $SOSCONTAINER.
  17. # If the option '-l' is enabled the removal/squeeze is repeated every <delay>
  18. # seconds. The default value for <delay> is 300s, i.e. 5min.
  19. #
  20.  
  21. BINDIR=${SOSPATH-__SOS_INSTALLED_PATH__}/bin/
  22.  
  23. cd ${SOSCONTAINER?}
  24.  
  25. [ "$1" = '-l' ] && { loop='+'; shift
  26.              if [ $# -gt 0 ] ; then
  27.             delay="$1"; shift
  28.              else
  29.             delay='3600'
  30.              fi
  31.            }
  32.  
  33. [ $# -gt 0    ] && { echo >&2 '*** usage: sos-cct [-l]'; exit 1 ;}
  34.  
  35. while true
  36. do
  37.    for cnt in [0-9]*
  38.    do
  39.       [ -f "$cnt" ] && {
  40.          ${BINDIR}cnt -t -d $cnt 2> /dev/null
  41.          ${BINDIR}cnt -t -s $cnt 2> /dev/null
  42.          }
  43.    done
  44.    
  45.    [ "$loop" ] || break
  46.    
  47.    sleep $delay
  48. done
  49.